package com.superman.supermarket.client.view.skulist;

import java.util.List;
import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
import com.superman.mvpframe.client.mvp.IPageViewPresenter;
import com.superman.mvpframe.client.widget.pulltorefresh.IPullToRefreshView;
import com.superman.mvpframe.client.widget.pulltorefresh.PullToRefreshViewAbstractImpl;
import com.superman.supermarket.client.composite.home.recommandgoods.RecommandGoodsModule;
import com.superman.supermarket.client.widget.header.CommonPageHeader;

/**
 * 商品列表页面实现类
 * 
 * @author superman
 * @version 2018年8月14日下午4:22:29
 */
public class SkuListViewImpl extends PullToRefreshViewAbstractImpl implements SkuListView {

	interface SkuListViewImplUiBinder extends UiBinder<Widget, SkuListViewImpl> {
	}

	private static SkuListViewImplUiBinder uiBinder = GWT.create(SkuListViewImplUiBinder.class);

	@UiField
	CommonPageHeader pageheader;
	@UiField
	FlowPanel wrapperpanel, skulistpanel;

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月14日 下午4:22:27
	 */
	public SkuListViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public IPullToRefreshView getPullToRefreshView() {
		return this;
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public void setDataListDivId(String id) {
		skulistpanel.getElement().setId(id);
	}

	@Override
	public void setListData(List<Map<String, Object>> list) {
		for (Map<String, Object> map : list) {
			RecommandGoodsModule recommandGoodsModule = new RecommandGoodsModule();
			recommandGoodsModule.setData(map);
			skulistpanel.add(recommandGoodsModule);
		}
	}

	@Override
	public void setMeScrollDivId(String id) {
		wrapperpanel.getElement().setId(id);
	}

	@Override
	public void setPageHeaderText(String cname) {
		pageheader.setText(cname);
	}

	@Override
	public void setPageViewPresenter(IPageViewPresenter presenter) {
		// TODO Auto-generated method stub

	}

}
